<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
if (GRAPH_TYPE == "plotkit")
{
	?>
    <script language="javascript" type="text/javascript" src="/_common/js/mochikit/MochiKit.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/excanvas.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/Base.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/Layout.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/Canvas.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/SweetCanvas.js"></script>
    <?
}
if (is_array($aModuleInfo))
{
	
	$k=1;
	foreach ($aModuleInfo as $aModule)
	{
		if ($aModule["type"] == 2)
		{
			$sParam = str_replace("[hostname]", "", $aModule["parameters"]);
			$sParam = trim($sParam);
			if ($sParam != "")
			{
				$sParam = "(".$sParam.")";
			}
			
			
			if (GRAPH_TYPE == "plotkit")
			{
				$aInfo["serverModuleID"]= $aModule["serverModuleID"];
				$aInfo["serverID"] = $aModule["serverID"];
				$aInfo["modID"] = $aModule["moduleID"];
				$aInfo["type"]=$nType;
				$aInfo["nStartTime"] = $nStartTime;
				$aInfo["nEndTime"] = $nEndTime;
				
				$data = $BigDaddyData->GetPlotKitData("ServerModuleHistoryNonBooleanGraph", $aInfo);
				?>
				<script language="javascript">
				
				  
				function drawGraph<?=$k;?>()
				{
					var options = {
						"IECanvasHTC": "/plotkit/iecanvas.htc",
						"xTicks": [<?=$data["xTicks"];?>]
					
					};
					var layout = new PlotKit.Layout("line", options);
					var dataset = new Array();
				
					dataset = [<?=$data["dataset"];?>];
				
					layout.addDataset("graph<?=$k;?>", dataset);
					layout.evaluate();
					var canvas = MochiKit.DOM.getElement("graph<?=$k;?>");
					var plotter = new PlotKit.SweetCanvasRenderer(canvas, layout,options);
					plotter.render();
				}
				
				MochiKit.DOM.addLoadEvent(drawGraph<?=$k;?>);
				</script>
				<p><b><?=$aModule["module_name"];?>: <?=$data["title"];?></b></p>
				
				<div><canvas id="graph<?=$k;?>" height="300" width="800"></canvas></div>
				<?
			}
			else if (GRAPH_TYPE == "jpgraph")
			{
				?>
				<p><b><?=$aModule["module_name"];?> <?=$sParam;?></b></p>
				<img src="<?=$_SERVER["PHP_SELF"]."?page=ServerModuleHistoryNonBooleanGraph&serverModuleID=".$aModule["serverModuleID"]."&serverID=".$aModule["serverID"]."&modID=".$aModule["moduleID"]."&type=".$nType."&nStartTime=".$nStartTime."&nEndTime=".$nEndTime?>" />
				<br>
				<?
			}
			
			$k++;
		}
	}
}

?>

	
	
